/**
 * Created by Administrator on 2016/1/20.
 */
//var fs = require('fs');
//console.log("准备写入文件");
//fs.writeFile('/workspace/js/webstorm/Rodman/data.txt', data,  function(err) {
//    if (err) {
//        return console.error(err);
//    }
//    console.log("数据写入成功！");
//});

var Source;
var self = this;
require([
    'wangwu/sxyc/AppMap',
    'dojo/on',
    'dojo/query',
    'dojo/_base/lang',
    "dojo/_base/array",
    "dojo/_base/event",
    "dojo/parser",

    "esri/toolbars/draw",
    "esri/toolbars/edit",
    "esri/graphic",
    'esri/layers/GraphicsLayer',
    "esri/config",

    "esri/dijit/editing/TemplatePicker"



], function(AppMap, on,djQuery,lang,arrayUtils,event,parser,
            Draw, Edit, Graphic,GraphicsLayer,esriConfig,
            TemplatePicker){


    self.appmap = new AppMap('mapDiv', {

    });
    on(self.appmap,'map-did-load',function(){
        $.ajax({
            url: '/javascripts/wangwu/sxyc/data.json',
            method: 'get',
            success: function (json) {
                //console.log(json);
                self.appmap.zhiqu.setDataSource(json);
                self.appmap.get.setDataSource({layerid:self.appmap.zhiqu.layer.id});
                self.appmap.handle.setDataSource({layerid:self.appmap.zhiqu.layer.id});
                on(self.appmap.handle,'edit-end',function(e){
                    console.log(e);
                })
            }
        })
    });
    self.appmap.init();

})